<?php
require_once(str_replace("\\", "/", dirname(__FILE__)) . "/../config.inc.php");
$key = $_POST["key"];
$stock = $context->getBean("modules.finance.business.stock");
$stocks = $stock->getStocks(null, $key);
$str_stocks = "";
foreach($stocks as $stock){
    $str_stocks .= ",{ \"label\":\"" . $stock["name"] . "\", \"value\": \"" . $stock["symbol"] . "\", \"pinyin\": \"" . $stock["pinyin"] . "\" }";
}
if(strlen($str_stocks) > 0){
    $str_stocks = substr($str_stocks, 1);
}

Header("Content-type: javascript/js; charset=utf-8");
echo "[$str_stocks]";
?>
